package tw101.bm;

/**
 * Created by Alan on 12/29/13.
 */
public class DiamondNamePrinter extends ShapePrinter {

    public static void main (String[] args) {
        int numLines = getN(args);
        new DiamondNamePrinter().makeShape(numLines);
    }

    void makeShape(int linesInTriangle) {
        printUpwardsTriangle(linesInTriangle);
        System.out.println("Becccie");
        printDownwardsTriangle(linesInTriangle);
    }

    private void printDownwardsTriangle(int linesInTriangle) {
        int asterisks = asterisksAtLine(linesInTriangle-1);
        int spaces = 1;

        for (; spaces<linesInTriangle; spaces++) {
            printLine(spaces, asterisks);
            asterisks -= 2;
        }
    }

    private void printUpwardsTriangle(int linesInTriangle) {
        int asterisks = asterisksAtLine(1);
        int spaces = linesInTriangle - asterisks;

        for (; spaces>0; spaces--) {
            printLine(spaces, asterisks);
            asterisks += 2;
        }
    }

    private int asterisksAtLine(int line) {
        return line*2 - 1;
    }
}
